#ifndef _Ape_Exception_h
#define _Ape_Exception_h

#include <Ape/Object.h>
#include <Ape/Cloneable.h>

#ifdef WITH_EXCEPTIONS

namespace Ape {
	class String;
	namespace Collections {
		template<typename E_t>
		class LinkedList;
		
		class StringList;
	}
	
	
	/**
		Recommended to be the very base for all exceptions
		@author Roman Gafiyatullin
	*/
	class Exception
				: public Object
	{
		TYPE_NAME ("Ape::Exception")
		CLONEABLE (Exception)
	private:
		String* m_Msg;
		Collections::StringList* m_StackTrace;
	public:
		/**
			initialize with empty message
		*/
		Exception();
		/**
			initialize with message
			@param msg message
		*/
		Exception (const wchar_t* msg);
		
		Exception (const Exception& other);
		/**
			dtor
		*/
		virtual ~Exception();
		
		const /*Collections::LinkedList<String>*/Collections::StringList& get_StackTrace() const;
		
		/**
			@return the message of this exception
		*/
		const String get_Message() const;
		
		virtual void _Dump (bool verbose = false) const;
		
		virtual const String ToString() const;
		
		static void GetCurrentStackTrace (Collections::LinkedList<String>* list);
	};
}

#endif // WITH_EXCEPTIONS

#endif // _Ape_Exception_h


